﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BankSystem.Classes
{
    internal class CreditAccount : Account
    {
        private string bank;
        private ID id;
        private string password;
        private double balance;

        public CreditAccount(string bank, ID id, string password, double balance)
        {
            this.bank = bank;
            this.id = id;
            this.password = password;
            this.balance = balance;
        }

        public string getBank()
        {
            return bank;
        }

        public string getID()
        {
            return id.toString();
        }

        public bool CheckPassword(string password)
        {
            return password.Equals(this.password);
        }

        public void SaveMoney(double amount)
        {
            balance += amount;
        }

        public double getBalance()
        {
            return balance;
        }

        public void WithdrawMoney(double amount)
        {
            if (amount > balance)
                throw new AccountDealingException(true, false);
            balance += amount;
        }
    }
}
